package stz.flash.option.app;

import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.FieldChangeListener;
import stz.flash.option.OptionLabel;
import stz.flash.option.Option;
import stz.flash.string.OptionInformation;
import stz.flash.string.OptionString;
import blackberry.util.field.DjCheckboxField;
import blackberry.util.field.DjLabelField;


public class BackgroundExecuteCheckBox extends DjCheckboxField implements FieldChangeListener{

	public BackgroundExecuteCheckBox() {
		super(DjLabelField.createSimpleLabel(OptionString.BACKGROUND_APP_CHECK_BOX_FIELD),
				OptionLabel.createInfoLabel(OptionInformation.BACKGROUND_EXECUTE_CHECKBOX),
				Option.getIns().isBackgroundExecute());
		setChangeListener(this);
	}

	public void fieldChanged(Field field, int context) {
		if (PROGRAMMATIC == context) {
			return;
		}
		if (getChecked())
			Option.getIns().setBackgroundExecute(true);
		else
			Option.getIns().setBackgroundExecute(false);		
	}
}